home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / tools / bison.lha / bison++-1.04 / vmsgetargs.c < prev    next >
C/C++ Source or Header  |  1989-06-09  |  3KB  |  116 lines

  1. /* VMS version of getargs; Uses DCL command parsing.
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 1, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18.  
  19. #include <ctype.h>
  20.  
  21. /*
  22.  *    VMS version of getargs(): Uses DCL command parsing
  23.  *        (argc and argv are ignored)
  24.  */
  25. int verboseflag;
  26. int definesflag;
  27. int debugflag;
  28. int nolinesflag;
  29. extern int fixed_outfiles;
  30.  
  31. getargs(argc,argv)
  32.      int argc;
  33.      char *argv[];
  34. {
  35.   register char *cp;
  36.   static char Input_File[256];
  37.   extern char *infile;
  38.  
  39.   verboseflag = 0;
  40.   definesflag = 0;
  41.   debugflag = 0;
  42.   fixed_outfiles = 0;
  43.   nolinesflag = 0;
  44.   /*
  45.    *    Check for /VERBOSE qualifier
  46.    */
  47.   if (cli_present("BISON$VERBOSE")) verboseflag = 1;
  48.   /*
  49.    *    Check for /DEFINES qualifier
  50.    */
  51.   if (cli_present("BISON$DEFINES")) definesflag = 1;
  52.   /*
  53.    *    Check for /FIXED_OUTFILES qualifier
  54.    */
  55.   if (cli_present("BISON$FIXED_OUTFILES")) fixed_outfiles = 1;
  56.   /*
  57.    *    Check for /NOLINES qualifier
  58.    */
  59.   if (cli_present("BISON$NOLINES")) nolinesflag = 1;
  60.   /*
  61.    *    Check for /DEBUG qualifier
  62.    */
  63.   if (cli_present("BISON$DEBUG")) debugflag = 1;
  64.   /*
  65.    *    Get the filename
  66.    */
  67.   cli_get_value("BISON$INFILE", Input_File, sizeof(Input_File));
  68.   /*
  69.    *    Lowercaseify the input filename
  70.    */
  71.   cp = Input_File;
  72.   while(*cp) {
  73.     if (isupper(*cp)) *cp = tolower(*cp);
  74.     cp++;
  75.   }
  76.   infile = Input_File;
  77. }
  78.  
  79. /************        DCL PARSING ROUTINES        **********/
  80.  
  81. /*
  82.  *    See if "NAME" is present
  83.  */
  84. int
  85. cli_present(Name)
  86.      char *Name;
  87. {
  88.   struct {int Size; char *Ptr;} Descr;
  89.  
  90.   Descr.Ptr = Name;
  91.   Descr.Size = strlen(Name);
  92.   return((cli$present(&Descr) & 1) ? 1 : 0);
  93. }
  94.  
  95. /*
  96.  *    Get value of "NAME"
  97.  */
  98. int
  99. cli_get_value(Name,Buffer,Size)
  100.      char *Name;
  101.      char *Buffer;
  102. {
  103.   struct {int Size; char *Ptr;} Descr1,Descr2;
  104.  
  105.   Descr1.Ptr = Name;
  106.   Descr1.Size = strlen(Name);
  107.   Descr2.Ptr = Buffer;
  108.   Descr2.Size = Size-1;
  109.   if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) {
  110.     Buffer[Descr2.Size] = 0;
  111.     return(1);
  112.   }
  113.   return(0);
  114. }
  115.  
  116.